package com.yanqu.road.server.manager.tomb;

import com.yanqu.road.server.manager.tomb.entity.DbTombUser;

import java.time.LocalDateTime;

public class HeartbeatInfo {

    public static HeartbeatInfo newInstance(DbTombUser dbTombUser) {
        HeartbeatInfo heartbeatInfo = new HeartbeatInfo();
        heartbeatInfo.setUserId(dbTombUser.getUserId());
        heartbeatInfo.setServerId(dbTombUser.getUserInfo().getServerId());
        heartbeatInfo.setUnionUid(dbTombUser.getUserInfo().getUnionUid());
        heartbeatInfo.setFloor(dbTombUser.getFloor());
        heartbeatInfo.setDateTime(LocalDateTime.now());
        heartbeatInfo.setGroupId(dbTombUser.getGroupId());
        return heartbeatInfo;
    }
    private long userId;

    private long serverId;

    private String unionUid;
    private LocalDateTime dateTime;

    private int floor;

    private int groupId;

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }

    public void updateDataTime(int floor) {
        this.dateTime = LocalDateTime.now();
        this.setFloor(floor);
    }


    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        this.serverId = serverId;
    }

    public String getUnionUid() {
        return unionUid;
    }

    public void setUnionUid(String unionUid) {
        this.unionUid = unionUid;
    }

    public int getFloor() {
        return floor;
    }

    public void setFloor(int floor) {
        this.floor = floor;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
}
